home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / utils / xad / developer / include / c / libraries / xadmaster.h
C/C++ Source or Header  |  1999-01-01  |  22KB  |  513 lines

  1. #ifndef LIBRARIES_XADMASTER_H
  2. #define LIBRARIES_XADMASTER_H
  3.  
  4. /*
  5. **    $VER: xadmaster.h 1.8 (16.03.1999)
  6. **    xadmaster.library defines and structures
  7. **
  8. **    Copyright © 1998 by Dirk Stöcker
  9. **    All Rights Reserved.
  10. */
  11.  
  12. #ifndef EXEC_LIBRARIES_H
  13. #include <exec/libraries.h>
  14. #endif
  15.  
  16. #ifndef UTILITY_TAGITEM_H
  17. #include <utility/tagitem.h>
  18. #endif
  19.  
  20. /************************************************************************
  21. *                                                *
  22. *    library base structure                        *
  23. *                                                *
  24. ************************************************************************/
  25.  
  26. struct xadMasterBase {
  27.   struct Library       xmb_LibNode;
  28.   struct ExecBase *    xmb_SysBase;
  29.   struct DosLibrary *  xmb_DOSBase;
  30.   struct UtilityBase * xmb_UtilityBase;
  31.   ULONG               xmb_RecogSize;    /* read only */
  32. };
  33.  
  34. /************************************************************************
  35. *                                                *
  36. *    tag-function call flags                               *
  37. *                                                *
  38. ************************************************************************/
  39.  
  40. /* input tags for xadGetInfo, only one can be specified per call */
  41. #define XAD_INSIZE        (TAG_USER+  1) /* input data size */
  42. #define XAD_INFILENAME        (TAG_USER+  2)
  43. #define XAD_INFILEHANDLE    (TAG_USER+  3)
  44. #define XAD_INMEMORY        (TAG_USER+  4)
  45. #define XAD_INHOOK        (TAG_USER+  5)
  46.  
  47. /* output tags, only one can be specified per call, xadXXXXUnArc */
  48. #define XAD_OUTSIZE        (TAG_USER+ 10) /* output data size */
  49. #define XAD_OUTFILENAME        (TAG_USER+ 11)
  50. #define XAD_OUTFILEHANDLE    (TAG_USER+ 12)
  51. #define XAD_OUTMEMORY        (TAG_USER+ 13)
  52. #define XAD_OUTHOOK        (TAG_USER+ 14)
  53. #define XAD_OUTDEVICE        (TAG_USER+ 15) /* for disk archives only */
  54.  
  55. /* object allocation tags for xadAllocObjectA */
  56. #define XAD_OBJNAMESIZE        (TAG_USER+ 20) /* XADOBJ_FILEINFO, size of needed name space */
  57. #define XAD_OBJCOMMENTSIZE    (TAG_USER+ 21) /* XADOBJ_FILEINFO, size of needed comment space */
  58. #define XAD_OBJPRIVINFOSIZE    (TAG_USER+ 22) /* XADOBJ_FILEINFO & XADOBJ_DISKINFO, self use size */
  59. #define XAD_OBJBLOCKENTRIES    (TAG_USER+ 23) /* XADOBJ_DISKINFO, number of needed entries */
  60.  
  61. /* tags for xadGetInfo, xadFileUnArc and xadDiskUnArc */
  62. #define XAD_NOEXTERN        (TAG_USER+ 50) /* do not use extern clients */
  63. #define XAD_PASSWORD        (TAG_USER+ 51) /* password when needed */
  64. #define XAD_ENTRYNUMBER        (TAG_USER+ 52) /* number of wanted entry */
  65. #define XAD_PROGRESSHOOK    (TAG_USER+ 53) /* the progress hook */
  66. #define XAD_OVERWRITE        (TAG_USER+ 54) /* overwrite file ? */
  67. #define XAD_MAKEDIRECTORY    (TAG_USER+ 55) /* create directory tree */
  68. #define XAD_IGNOREGEOMETRY    (TAG_USER+ 56) /* ignore drive geometry ? */
  69. #define XAD_LOWCYLINDER        (TAG_USER+ 57) /* lowest cylinder */
  70. #define XAD_HIGHCYLINDER    (TAG_USER+ 58) /* highest cylinder */
  71. #define XAD_VERIFY        (TAG_USER+ 59) /* verify for disk hook */
  72.  
  73. /* input tags for xadConvertDates, only one can be passed */
  74. #define XAD_DATEUNIX        (TAG_USER+ 70) /* unix date variable */
  75. #define XAD_DATEAMIGA        (TAG_USER+ 71) /* amiga date variable */
  76. #define XAD_DATEDATESTAMP    (TAG_USER+ 72) /* struct DateStamp */
  77. #define XAD_DATEXADDATE        (TAG_USER+ 73) /* struct xadDate */
  78. #define XAD_DATECLOCKDATA    (TAG_USER+ 74) /* struct ClockData */
  79. #define XAD_DATECURRENTTIME    (TAG_USER+ 75) /* input is system time */
  80.  
  81. /* output tags, there can be specified multiple tags for one call */
  82. #define XAD_GETDATEUNIX        (TAG_USER+ 80) /* unix date variable */
  83. #define XAD_GETDATEAMIGA    (TAG_USER+ 81) /* amiga date variable */
  84. #define XAD_GETDATEDATESTAMP    (TAG_USER+ 82) /* struct DateStamp */
  85. #define XAD_GETDATEXADDATE    (TAG_USER+ 83) /* struct xadDate */
  86. #define XAD_GETDATECLOCKDATA    (TAG_USER+ 84) /* struct ClockData */
  87.  
  88. /* following tags need locale.library to be installed */
  89. #define XAD_MAKEGMTDATE        (TAG_USER+ 90) /* make local to GMT time */
  90. #define XAD_MAKELOCALDATE    (TAG_USER+ 91) /* make GMT to local time */
  91.  
  92. /************************************************************************
  93. *                                                *
  94. *    objects for xadAllocObjectA                           *
  95. *                                                *
  96. ************************************************************************/
  97.  
  98. #define XADOBJ_ARCHIVEINFO    0x0001 /* struct xadArchiveInfo */
  99. #define XADOBJ_FILEINFO        0x0002 /* struct xadFileInfo */
  100. #define XADOBJ_DISKINFO        0x0003 /* struct xadDiskInfo */
  101. #define XADOBJ_HOOKPARAM    0x0004 /* struct HookParam */
  102. #define XADOBJ_DEVICEINFO    0x0005 /* struct xadDeviceInfo */
  103. #define XADOBJ_PROGRESSINFO    0x0006 /* struct xadProgressInfo */
  104. #define XADOBJ_TEXTINFO        0x0007 /* struct xadTextInfo */
  105.  
  106. /************************************************************************
  107. *                                                *
  108. *    modes for xadCalcCRC126 and xadCalcCRC32                *
  109. *                                                *
  110. ************************************************************************/
  111.  
  112. #define XADCRC16_ID1        0xA001
  113. #define XADCRC32_ID1        0xEDB88320
  114.  
  115. /************************************************************************
  116. *                                                *
  117. *    hook related stuff                                *
  118. *                                                *
  119. ************************************************************************/
  120.  
  121. #define XADHC_READ    1    /* read data into buffer */
  122. #define XADHC_WRITE    2    /* write buffer data to file/memory */
  123. #define XADHC_SEEK    3    /* seek in file */
  124. #define XADHC_INIT    4    /* initialize the hook */
  125. #define XADHC_FREE    5    /* end up hook work, free stuff */
  126. #define XADHC_ABORT    6    /* an error occured, delete partial stuff */
  127. #define XADHC_FULLSIZE    7    /* complete input size is needed */
  128.  
  129. struct xadHookParam {
  130.   ULONG xhp_Command;
  131.   ULONG xhp_CommandData;
  132.   APTR  xhp_BufferPtr;
  133.   LONG  xhp_BufferSize;
  134.   LONG  xhp_DataPos;        /* current seek position */
  135.   APTR  xhp_PrivatePtr;
  136. };
  137.  
  138. /* xadHookAccess commands */
  139. #define XADAC_READ        10    /* get data */
  140. #define    XADAC_WRITE        11    /* write data */
  141. #define XADAC_COPY        12    /* copy input to ouput */
  142. #define XADAC_INPUTSEEK        13    /* seek in input file */
  143. #define XADAC_OUTPUTSEEK    14    /* seek in output file */
  144.  
  145. /************************************************************************
  146. *                                                *
  147. *    support structures                              *
  148. *                                                *
  149. ************************************************************************/
  150.  
  151. /* Own date structure to cover all possible dates in a human friendly
  152.    format. xadConvertDates may be used to convert between different date
  153.    structures and variables. */
  154. struct xadDate {
  155.   ULONG xd_Micros;    /* values 0 to 999999     */
  156.   LONG  xd_Year;    /* values 1 to 2147483648 */
  157.   UBYTE xd_Month;    /* values 1 to 12         */
  158.   UBYTE xd_WeekDay;    /* values 1 to 7          */
  159.   UBYTE xd_Day;        /* values 1 to 31         */
  160.   UBYTE xd_Hour;    /* values 0 to 23         */
  161.   UBYTE xd_Minute;    /* values 0 to 60         */
  162.   UBYTE xd_Second;    /* values 0 to 60         */
  163. };
  164.  
  165. #define XADDAY_MONDAY        1    /* monday is the first day and */
  166. #define XADDAY_TUESDAY        2
  167. #define XADDAY_WEDNESDAY    3
  168. #define XADDAY_THURSDAY        4
  169. #define XADDAY_FRIDAY        5
  170. #define XADDAY_SATURDAY     6
  171. #define XADDAY_SUNDAY        7    /* sunday the last day of a week */
  172.  
  173. struct xadDeviceInfo { /* for XAD_OUTDEVICE tag */
  174.   STRPTR xdi_DeviceName; /* name of device */
  175.   ULONG  xdi_Unit;     /* unit of device */
  176.   STRPTR xdi_DOSName;     /* instead of Device+Unit, dos name without ':' */
  177. };
  178.  
  179. /************************************************************************
  180. *                                                *
  181. *    information structures                              *
  182. *                                                *
  183. ************************************************************************/
  184.  
  185. struct xadArchiveInfo {
  186.   struct xadClient *   xai_Client;   /* pointer to unarchiving client */
  187.   APTR               xai_PrivateClient; /* private client data */
  188.   STRPTR           xai_Password; /* password for crypted archives */
  189.   ULONG               xai_Flags;    /* read only XADAIF_ flags */
  190.   ULONG               xai_LowCyl;   /* lowest cylinder to unarchive */
  191.   ULONG               xai_HighCyl;  /* highest cylinder to unarchive */
  192.   ULONG               xai_InPos;    /* input position, read only */
  193.   ULONG               xai_InSize;   /* input size, read only */
  194.   ULONG               xai_OutPos;   /* output position, read only */
  195.   ULONG               xai_OutSize;  /* output file size, read only */
  196.   struct xadFileInfo * xai_FileInfo; /* data pointer for file arcs */
  197.   struct xadDiskInfo * xai_DiskInfo; /* data pointer for disk arcs */
  198.   struct xadFileInfo * xai_CurFile;  /* data pointer for current file arc */
  199.   struct xadDiskInfo * xai_CurDisk;  /* data pointer for current disk arc */
  200. };
  201. /* This structure is nearly complete private to either xadmaster or its
  202. clients. An application program may access for reading only xai_Client,
  203. xai_Flags, xai_FileInfo and xai_DiskInfo. For xai_Flags only XADAIF_CRYPTED
  204. and XADAIF_FILECORRUPT are useful. All the other stuff is private and should
  205. not be accessed! */
  206.  
  207. #define XADAIB_CRYPTED        0 /* archive entries are encrypted */
  208. #define XADAIB_FILECORRUPT    1 /* file is corrupt, but valid entries are in the list */
  209. #define XADAIB_FILEARCHIVE    2 /* unarchive file entry */
  210. #define XADAIB_DISKARCHIVE    3 /* unarchive disk entry */
  211. #define XADAIB_OVERWRITE    4 /* overwrite the file */
  212. #define XADAIB_MAKEDIRECTORY    5 /* create directory when missing */
  213. #define XADAIB_IGNOREGEOMETRY    6 /* ignore drive geometry */
  214. #define XADAIB_VERIFY        7 /* verify is turned on for disk hook */
  215.  
  216. #define XADAIF_CRYPTED        (1<<XADAIB_CRYPTED)
  217. #define XADAIF_FILECORRUPT    (1<<XADAIB_FILECORRUPT)
  218. #define XADAIF_FILEARCHIVE    (1<<XADAIB_FILEARCHIVE)
  219. #define XADAIF_DISKARCHIVE    (1<<XADAIB_DISKARCHIVE)
  220. #define XADAIF_OVERWRITE    (1<<XADAIB_OVERWRITE)
  221. #define XADAIF_MAKEDIRECTORY    (1<<XADAIB_MAKEDIRECTORY)
  222. #define XADAIF_IGNOREGEOMETRY    (1<<XADAIB_IGNOREGEOMETRY)
  223. #define XADAIF_VERIFY        (1<<XADAIB_VERIFY)
  224.  
  225. struct xadFileInfo {
  226.   struct xadFileInfo * xfi_Next;
  227.   ULONG               xfi_EntryNumber;/* number of entry, starts with 1 */
  228.   STRPTR           xfi_EntryInfo;  /* additional archiver text */
  229.   APTR               xfi_PrivateInfo;/* client private, see XAD_OBJPRIVINFOSIZE */
  230.   ULONG               xfi_Flags;      /* see XADFIF_xxx defines */
  231.   STRPTR           xfi_FileName;   /* see XAD_OBJNAMESIZE tag */
  232.   STRPTR           xfi_Comment;    /* see XAD_OBJCOMMENTSIZE tag */
  233.   ULONG             xfi_Protection; /* OS 3 bits (including multiuser) */
  234.   ULONG               xfi_OwnerUID;   /* user ID */
  235.   ULONG               xfi_OwnerGID;   /* group ID */
  236.   STRPTR           xfi_UserName;   /* user name */
  237.   STRPTR           xfi_GroupName;  /* group name */
  238.   ULONG                xfi_Size;       /* size of this file */
  239.   ULONG               xfi_GroupCrSize;/* crunched size of group */
  240.   ULONG               xfi_CrunchSize; /* crunched size */
  241.   STRPTR           xfi_LinkName;   /* name and path of link */
  242.   struct xadDate       xfi_Date;
  243. };
  244.  
  245. #define XADFIB_CRYPTED        0 /* entry is crypted */
  246. #define XADFIB_DIRECTORY    1 /* entry is a directory */
  247. #define XADFIB_LINK        2 /* entry is a link */
  248. #define XADFIB_INFOTEXT        3 /* file is an information text */
  249. #define XADFIB_GROUPED        4 /* file is in a crunch group */
  250. #define XADFIB_ENDOFGROUP    5 /* crunch group ends here */
  251. #define XADFIB_NODATE        6 /* no date supported, current date is set */
  252.  
  253. #define XADFIF_CRYPTED        (1<<XADFIB_CRYPTED)
  254. #define XADFIF_DIRECTORY    (1<<XADFIB_DIRECTORY)
  255. #define XADFIF_LINK        (1<<XADFIB_LINK)
  256. #define XADFIF_INFOTEXT        (1<<XADFIB_INFOTEXT)
  257. #define XADFIF_GROUPED        (1<<XADFIB_GROUPED)
  258. #define XADFIF_ENDOFGROUP    (1<<XADFIB_ENDOFGROUP)
  259. #define XADFIF_NODATE        (1<<XADFIB_NODATE)
  260.  
  261. /* NOTE: the texts passed with that structure must not always be printable.
  262.    Although the clients should add an additional (not counted) zero at the text
  263.    end, the whole file may contain other unprintable stuff (e.g. for DMS).
  264.    So when printing this texts do it on a byte for byte base including
  265.    printability checks.
  266. */
  267. struct xadTextInfo {
  268.   struct xadTextInfo *    xti_Next;
  269.   ULONG            xti_Size;  /* maybe zero - no text - e.g. when crypted */
  270.   STRPTR        xti_Text;  /* and there is no password in xadGetInfo() */
  271.   ULONG            xti_Flags; /* see XADTIF_xxx defines */
  272. };
  273.  
  274. #define XADTIB_CRYPTED        0 /* entry is empty, as data was crypted */
  275. #define XADTIB_BANNER        1 /* text is a banner */
  276. #define XADTIB_FILEDIZ        2 /* text is a file description */
  277.  
  278. #define XADTIF_CRYPTED        (1<<XADTIB_CRYPTED)
  279. #define XADTIF_BANNER        (1<<XADTIB_BANNER)
  280. #define XADTIF_FILEDIZ        (1<<XADTIB_FILEDIZ)
  281.  
  282. struct xadDiskInfo {
  283.   struct xadDiskInfo *  xdi_Next;
  284.   ULONG                xdi_EntryNumber;  /* number of entry, starts with 1 */
  285.   STRPTR            xdi_EntryInfo;    /* additional archiver text */
  286.   APTR                xdi_PrivateInfo;  /* client private, see XAD_OBJPRIVINFOSIZE */
  287.   ULONG            xdi_Flags;      /* see XADDIF_xxx defines */
  288.   ULONG                xdi_SectorSize;
  289.   ULONG            xdi_TotalSectors; /* see devices/trackdisk.h */
  290.   ULONG                xdi_Cylinders;      /* to find out what these */
  291.   ULONG                xdi_CylSectors;      /* fields mean, they are equal */
  292.   ULONG                xdi_Heads;      /* to struct DriveGeometry */
  293.   ULONG            xdi_TrackSectors;
  294.   ULONG                xdi_LowCyl;       /* lowest cylinder stored */
  295.   ULONG                xdi_HighCyl;      /* highest cylinder stored */
  296.   ULONG            xdi_BlockInfoSize;/* number of BlockInfo entries */
  297.   UBYTE *        xdi_BlockInfo;    /* see XADBIF_xxx defines and XAD_OBJBLOCKENTRIES tag */
  298.   struct xadTextInfo *    xdi_TextInfo;      /* linked list with info texts */
  299. };
  300.  
  301. /* BlockInfo points to a UBYTE field for every track from first sector of
  302.    lowest cylinder to last sector of highest cylinder. When not used,
  303.    pointer must be 0. Do not use it, when there are no entries!
  304.    This is just for information. The applications still asks the client
  305.    to unarchive whole cylinders and not archived blocks are cleared for
  306.    unarchiving.
  307. */
  308.  
  309. #define XADDIB_CRYPTED          0 /* entry is crypted */
  310.  
  311. /* Some of the crunchers do not store all necessary information, so it
  312. may be needed to guess some of them. Set the following flags in that case
  313. and geometry check will ignore these fields. */
  314. #define XADDIB_GUESSCYLINDERS      7 /* cylinder number is guessed */
  315. #define XADDIB_GUESSCYLSECTORS      8 /* cylsectors is guessed */
  316. #define XADDIB_GUESSHEADS      9 /* number of heads is guessed */
  317. #define XADDIB_GUESSTRACKSECTORS 10 /* tracksectors is guessed */
  318. #define XADDIB_GUESSLOWCYL     11 /* lowcyl is guessed */
  319. #define XADDIB_GUESSHIGHCYL     12 /* highcyl is guessed */
  320.  
  321. /* If it is impossible to set some of the fields, you not to set some of
  322. these flags. NOTE: XADDIB_NOCYLINDERS is really important, as this turns
  323. of usage of lowcyl and highcyl keywords. When you have cylinder information,
  324. you should not use these and instead use guess flags and calculate
  325. possible values for the missing fields. */
  326. #define XADDIB_NOCYLINDERS     15 /* cylinder number is not set */
  327. #define XADDIB_NOCYLSECTORS     16 /* cylsectors is not set */
  328. #define XADDIB_NOHEADS          17 /* number of heads is not set */
  329. #define XADDIB_NOTRACKSECTORS    18 /* tracksectors is not set */
  330. #define XADDIB_NOLOWCYL          19 /* lowcyl is not set */
  331. #define XADDIB_NOHIGHCYL     20 /* highcyl is not set */
  332.  
  333. #define XADDIF_CRYPTED         (1<<XADDIB_CRYPTED)
  334.  
  335. #define XADDIF_GUESSCYLINDERS     (1<<XADDIB_GUESSCYLINDERS)
  336. #define XADDIF_GUESSCYLSECTORS     (1<<XADDIB_GUESSCYLSECTORS)
  337. #define XADDIF_GUESSHEADS     (1<<XADDIB_GUESSHEADS)
  338. #define XADDIF_GUESSTRACKSECTORS (1<<XADDIB_GUESSTRACKSECTORS)
  339. #define XADDIF_GUESSLOWCYL     (1<<XADDIB_GUESSLOWCYL)
  340. #define XADDIF_GUESSHIGHCYL     (1<<XADDIB_GUESSHIGHCYL)
  341.  
  342. #define XADDIF_NOCYLINDERS     (1<<XADDIB_NOCYLINDERS)
  343. #define XADDIF_NOCYLSECTORS     (1<<XADDIB_NOCYLSECTORS)
  344. #define XADDIF_NOHEADS         (1<<XADDIB_NOHEADS)
  345. #define XADDIF_NOTRACKSECTORS     (1<<XADDIB_NOTRACKSECTORS)
  346. #define XADDIF_NOLOWCYL         (1<<XADDIB_NOLOWCYL)
  347. #define XADDIF_NOHIGHCYL     (1<<XADDIB_NOHIGHCYL)
  348.  
  349. /* defines for BlockInfo */
  350. #define XADBIB_CLEARED        0 /* this block was cleared for archiving */
  351. #define XADBIB_UNUSED        1 /* this block was not archived */
  352.  
  353. #define XADBIF_CLEARED        (1<<XADBIB_CLEARED)
  354. #define XADBIF_UNUSED        (1<<XADBIB_UNUSED)
  355.  
  356. /************************************************************************
  357. *                                                *
  358. *    progress report stuff                              *
  359. *                                                *
  360. ************************************************************************/
  361.  
  362. struct xadProgressInfo {
  363.   ULONG            xpi_Mode;    /* work modus */
  364.   struct xadClient *    xpi_Client;    /* the client doing the work */
  365.   struct xadDiskInfo *    xpi_DiskInfo;    /* current diskinfo, for disks */
  366.   struct xadFileInfo *    xpi_FileInfo;    /* current info for files */
  367.   ULONG            xpi_CurrentSize;/* current filesize */
  368.   ULONG            xpi_LowCyl;    /* for disks only */
  369.   ULONG            xpi_HighCyl;    /* for disks only */
  370.   ULONG            xpi_Status;    /* see XADPIF flags */
  371.   LONG            xpi_Error;    /* any of the error codes */
  372. };
  373. /* NOTE: For disks CurrentSize is Sector*SectorSize, where SectorSize can
  374. be found in xadDiskInfo structure. So you may output the sector value. */
  375.  
  376. /* different progress modes */
  377. #define XADPMODE_ASK        1
  378. #define XADPMODE_PROGRESS    2
  379. #define XADPMODE_END        3
  380. #define XADPMODE_ERROR        4
  381.  
  382. /* flags for progress hook and ProgressInfo status field */
  383. #define XADPIB_OVERWRITE     0 /* overwrite the file */
  384. #define XADPIB_MAKEDIRECTORY     1 /* create the directory */
  385. #define XADPIB_IGNOREGEOMETRY     2 /* ignore drive geometry */
  386. #define XADPIB_OK        16 /* all ok, proceed */
  387. #define XADPIB_SKIP        17 /* skip file */
  388.  
  389. #define XADPIF_OVERWRITE    (1<<XADPIB_OVERWRITE)
  390. #define XADPIF_MAKEDIRECTORY    (1<<XADPIB_MAKEDIRECTORY)
  391. #define XADPIF_IGNOREGEOMETRY    (1<<XADPIB_IGNOREGEOMETRY)
  392. #define XADPIF_OK        (1<<XADPIB_OK)
  393. #define XADPIF_SKIP        (1<<XADPIB_SKIP)
  394.  
  395. /************************************************************************
  396. *                                                *
  397. *    errors                                       *
  398. *                                                *
  399. ************************************************************************/
  400.  
  401. #define XADERR_OK        0x0000 /* no error */
  402. #define XADERR_UNKNOWN        0x0001 /* unknown error */
  403. #define XADERR_INPUT        0x0002 /* input data buffers border exceeded */
  404. #define XADERR_OUTPUT        0x0003 /* output data buffers border exceeded */
  405. #define XADERR_BADPARAMS    0x0004 /* function called with illegal parameters */
  406. #define XADERR_NOMEMORY        0x0005 /* not enough memory available */
  407. #define XADERR_ILLEGALDATA    0x0006 /* data is corrupted */
  408. #define XADERR_NOTSUPPORTED    0x0007 /* command is not supported */
  409. #define XADERR_RESOURCE        0x0008 /* required resource missing */
  410. #define XADERR_DECRUNCH        0x0009 /* error on decrunching */
  411. #define XADERR_FILETYPE        0x000A /* unknown file type */
  412. #define XADERR_OPENFILE        0x000B /* opening file failed */
  413. #define XADERR_SKIP        0x000C /* file, disk has been skipped */
  414. #define XADERR_BREAK        0x000D /* user break in progress hook */
  415. #define XADERR_FILEEXISTS    0x000E /* file already exists */
  416. #define XADERR_PASSWORD        0x000F /* missing or wrong password */
  417. #define XADERR_MAKEDIR        0x0010 /* could not create directory */
  418. #define XADERR_CHECKSUM        0x0011 /* wrong checksum */
  419. #define XADERR_VERIFY        0x0012 /* verify failed (disk hook) */
  420. #define XADERR_GEOMETRY        0x0013 /* wrong drive geometry */
  421.  
  422. /************************************************************************
  423. *                                                *
  424. *    client related stuff                           *
  425. *                                                *
  426. ************************************************************************/
  427.  
  428. struct xadForeman {
  429.   ULONG             xfm_Security;    /* should be XADFOREMAN_SECURITY */
  430.   ULONG             xfm_ID;          /* must be XADFOREMAN_ID */
  431.   UWORD             xfm_Version;     /* set to XADFOREMAN_VERSION */
  432.   UWORD             xfm_Reserved;
  433.   STRPTR         xfm_VersString;  /* pointer to $VER: string */
  434.   struct xadClient * xfm_FirstClient; /* pointer to first client */
  435. };
  436.  
  437. #define XADFOREMAN_SECURITY    0x70FF4E75 /* MOVEQ #-1,D0 and RTS */
  438. #define XADFOREMAN_ID        0x58414446 /* 'XADF' identification ID */
  439. #define XADFOREMAN_VERSION    1
  440.  
  441. struct xadClient {
  442.   struct xadClient * xc_Next;
  443.   UWORD             xc_Version;    /* set to XADCLIENT_VERSION */
  444.   UWORD             xc_MasterVersion;
  445.   UWORD             xc_ClientVersion;
  446.   UWORD             xc_ClientRevision;
  447.   ULONG             xc_RecogSize;  /* needed size to recog the type */
  448.   ULONG             xc_Flags;      /* see XADCF_xxx defines */
  449.   ULONG             xc_Identifier; /* ID of internal clients */
  450.   STRPTR         xc_ArchiverName;
  451.   BOOL          (* xc_RecogData)();
  452.   LONG          (* xc_GetInfo)();
  453.   LONG          (* xc_UnArchive)();
  454.   void          (* xc_Free)();
  455. };
  456.  
  457. /* xc_RecogData returns 1 when recognized and 0 when not, all the others
  458.    return 0 when ok and XADERR values on error. xc_FinishUnArc has no
  459.    return value. */
  460.  
  461. /* function interface
  462. ASM(BOOL) xc_RecogData(REG(d0, ULONG size), REG(a0, STRPTR data),
  463.         REG(a6, struct xadMasterBase *xadMasterBase));
  464. ASM(LONG) xc_GetInfo(REG(a0, struct xadArchiveInfo *ai),
  465.         REG(a6, struct xadMasterBase *xadMasterBase));
  466. ASM(LONG) xc_UnArchive(REG(a0, struct xadArchiveInfo *ai),
  467.         REG(a6, struct xadMasterBase *xadMasterBase));
  468. ASM(void) xc_Free(REG(a0, struct xadArchiveInfo *ai),
  469.         REG(a6, struct xadMasterBase *xadMasterBase));
  470. */
  471.  
  472. #define XADCLIENT_VERSION    1
  473.  
  474. #define XADCB_FILEARCHIVER    0 /* archiver is a file archiver */
  475. #define XADCB_DISKARCHIVER    1 /* archiver is a disk archiver */
  476. #define XADCB_EXTERN        2 /* external client, set by xadmaster */
  477.  
  478. #define XADCF_FILEARCHIVER    (1<<XADCB_FILEARCHIVER)
  479. #define XADCF_DISKARCHIVER    (1<<XADCB_DISKARCHIVER)
  480. #define XADCF_EXTERN        (1<<XADCB_EXTERN)
  481.  
  482. /************************************************************************
  483. *                                                *
  484. *    client ID's                                   *
  485. *                                                *
  486. ************************************************************************/
  487.  
  488. /* If an external client has set the xc_Identifier field, the internal
  489. client is replaced. */
  490.  
  491. /* disk archivers start with 1000 */
  492. #define XADCID_XMASH            1000
  493. #define XADCID_SUPERDUPER3        1001
  494. #define XADCID_XDISK            1002
  495. #define XADCID_PACKDEV            1003
  496. #define XADCID_ZOOM            1004
  497. #define XADCID_ZOOM5            1005
  498.  
  499. /* file archivers start with 5000 */
  500. #define XADCID_TAR            5000
  501. #define XADCID_SDSSFX            5001
  502. #define XADCID_LZX            5002
  503. #define XADCID_MXMSIMPLEARC        5003
  504. #define XADCID_LHPAK            5004
  505. #define XADCID_AMIGAPLUSUNPACK        5005
  506. #define XADCID_AMIPACK            5006
  507.  
  508. /* mixed archivers start with 9000 */
  509. #define XADCID_DMS            9000
  510. #define XADCID_DMSSFX            9001
  511.  
  512. #endif /* LIBRARIES_XADMASTER_H */
  513.